** 
** Desc :      Patient Employment Detail update
** Called By : PMOD0.PRG
**
**  
** 7/12/99 - Dickson - use TEL3 field as the VAT Tax Code field
**
OKC=.F.
do while .not. okc
   if lastkey()=27
      return
   endif
   SELE 1
   cocod=JOB_CRPCOD
   CONAM=job_corp
   ADD1=job_ADD1
   ADD2=job_ADD2
   CITY=job_CITY
   COUNT=job_COUNT
   TEL1=job_TEL1
   TEL2=job_TEL2
   TEL3=job_TEL3
   FAX=job_FAX
   set color to bg+/b
   @ 10,1 clea to 23,78
   do boxt with 10,1,"Company : "+conam+' Company Code : '+COCOD,'bg+','b',.f.,.f.
   do boxT with 12,1,"Address : "+add1,'BG+','B',.F.,.F.
   do boxT with 14,1,"Nber & Street : "+ALLTRIM(add2)+"   City : "+ALLTRIM(city),'BG+','B',.F.,.F.
   do boxT with 16,1,"Country : "+count+"  Fax : "+ALLTRIM(fax),'BG+','B',.F.,.F.
   do boxT with 18,1,"Telephone : "+tel1+" or : "+tel2+" or : "+ALLTRIM(tel3),'BG+','B',.F.,.F.
   set color to bg+/b
   do box2 with 21,3,"DO YOU WANT TO MODIFY ? :",'YES','NO','GR+','R','GR+','N',Pl10,.f.,.T.
   IF PL10=1
      SET COLOR TO BG+/B
      @ 12,1 clea to 23,78
      do box2 with 12,1,"Do you have a company's name ? :",'YES','NO','BG+','b','gR+','N',Pl8,.f.,.f.
      SET COLOR TO W+/B
      @ 12,1 CLEA TO 14,78
      IF Pl8=1
         compin=space(5)
         do boxe with 10,3,'Enter Initial of company name : ','COMPIN','N','BG','W+','N',5,.T.,.T.
         if lastkey()<>27
            do preg401
            set color to w+/b
            @ 10,1 clea to 23,78
* Buu - Not allow for add-in new company in this screen
            if cocod='0000'
 		   STORE ' ' TO ADD1,ADD2,CITY,COUNT,TEL1,TEL2,TEL3,FAX
               do boxt with 10,1,'This Company does not exist - Pls add in company list','bg+','b',.f.,.f.
  *             do boxen  with 10,1,"Company :",'conam','BG+','B','W+','N',32,.F.,.F.
   *            do boxen with 12,1,"Address :",'add1','BG+','B','W+','N',48,.F.,.F.
    *           do boxen with 14,1,"Nber & Street :",'add2','BG+','B','W+','N',32,.F.,.F.
     *          do boxen with 14,53,"City :",'city','BG+','B','W+','N',16,.F.,.F.
      *         do boxen with 16,1,"Country :",'count','BG+','B','W+','N',16,.F.,.F.
       *        do boxen with 16,32,"Fax :",'fax','BG+','B','W+','N',14,.F.,.F.
        *       do boxen with 18,1,"Telephone :",'tel1','BG+','B','W+','N',16,.F.,.F.
         *      do boxen with 18,32,"or :",'tel2','BG+','B','W+','N',16,.F.,.F.
          *     do boxen with 18,56,"or :",'tel3','BG+','B','W+','N',16,.F.,.F.
		else
               SELE 2
               SET EXCLU OFF
               USE &DR&F2 INDEX &DR&F2
               SEEK COCOD
               IF .NOT. EOF()
                  CONAM=COMP_NAME
                  ADD1=COMP_ADD1
                  ADD2=COMP_ADD2
                  CITY=COMP_CITY
                  COUNT=COMP_COUNT
                  TEL1=COMP_TEL1
                  TEL2=COMP_TEL2
                  TEL3=COMP_TEL3
                  FAX=COMP_FAX
                  do boxt with 10,51,"Company Code : "+COCOD,'bg+','b',.f.,.f.
                  do boxT with 10,1,"Company : "+ALLTRIM(conam),'BG+','B',.F.,.F.
                  do boxT with 12,1,"Address : "+ALLTRIM(add1),'BG+','B',.F.,.F.
                  do boxT with 14,1,"Nber & Street : "+ALLTRIM(ADD2),'BG+','B',.F.,.F.
                  do boxT with 14,53,"City : "+ALLTRIM(city),'BG+','B',.F.,.F.
                  do boxT with 16,1,"Country : "+ALLTRIM(count),'BG+','B',.F.,.F.
                  do boxT with 16,32,"Fax : "+ALLTRIM(fax),'BG+','B',.F.,.F.
                  do boxT with 18,1,"Telephone : "+ALLTRIM(tel1),'BG+','B',.F.,.F.
                  do boxT with 18,32,"or : "+ALLTRIM(tel2),'BG+','B',.F.,.F.
                  do boxT with 18,56,"or : "+alltrim(tel3),'BG+','B',.F.,.F.
               ENDIF
            ENDIF
         endif
      else
         CONAM='NO RECORDED COMPANY'
         do boxF with 12,1,CONAM,'W+','B','W+*',.F.,.F.
         cocod='0000'
         STORE ' ' TO ADD1,ADD2,CITY,COUNT,TEL1,TEL2,TEL3,FAX
      ENDIF
      DO BOX3 WITH 20,3,"DO YOU WANT TO :",'CONFIRM','CANCEL','ESCAPE','GR+','R','W+','N',PL9,.T.,.T.
**
**  Amended by Dickson - to set the file back to Patient.dbf
      SELECT 1
**
      do case
         case PL9=1
            OKc=.t.
         case pl9=2
            OKc=.f.
         case pl9=3 .or. lastkey()=27
            return
      endcase
   ELSE
      OKC=.T.
   ENDIF
ENDDO
IF okc
   sele 1
   IF REC_LOCK(0)

*      REPL JOB_CRPCOD WITH COCOD,
** Check with Jakarta why this line was remarked
** Put back this line to update the company code in the patient.DBF
      REPL JOB_CRPCOD WITH COCOD
** Date 21/01/99

      REPL JOB_CORP WITH COnam,JOB_ADD1 WITH ADD1
      REPL JOB_ADD2 WITH ADD2,JOB_CITY WITH CITY,JOB_COUNT WITH COUNT,JOB_TEL1 WITH TEL1
      REPL JOB_TEL2 WITH TEL2,JOB_TEL3 WITH TEL3,JOB_FAX WITH FAX
*      if healthline=.f.
         REPL PAT_CODCRP WITH COCOD
*      endif
   ENDIF
   UNLOCK
ENDIF
RETURN



